import time

from selenium import webdriver
from unit01.Base.Base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    #登陆业务
    denglu_loc=(By.XPATH,'/html/body/div[1]/div[1]/div[4]/a')

    #输入用户名和密码
    user_loc=(By.ID,'TANGRAM__PSP_11__userName')
    # password_loc=(By.CLASS_NAME,'pass-text-input pass-text-input-password')
    password_loc = (By.ID, 'TANGRAM__PSP_11__password')

    #点击我已阅读
    yuedu_loc=(By.XPATH,'//*[@id="TANGRAM__PSP_11__isAgree"]')
    #点击登录
    login_loc=(By.XPATH,'//*[@id="TANGRAM__PSP_11__submit"]')
    #断言
    dy1_loc=(By.XPATH,'//*[@id="s-top-username"]/span[2]')

    def denglu(self):
        self.find_element(self.denglu_loc).click()

    def user(self,info):
        self.send_keys(self.user_loc,info)

    def password(self):
        self.send_keys(self.password_loc,'220516lljh')

    def yuedu(self):
        self.find_element(self.yuedu_loc).click()

    def login(self):
        self.find_element(self.login_loc).click()

    def dy1(self):
        self.wenben(self.dy1_loc)

    def baidu_ceshi_01(self,info):
        self.open_url('https://www.baidu.com/')
        self.denglu()
        time.sleep(3)
        self.user(info)
        self.password()
        self.yuedu()
        self.login()
        self.dy1()
        assert '198******46' in self.dy1()
        print(self.dy1())